package io.shuttle.mbe.api

import io.shuttle.mbe.api.types.Value1Function
import io.shuttle.mbe.core.Promise
import java.sql.Blob

////////////////////
// Page Capture
////////////////////
/**
 * Use the `Browser.pageCapture` API to save a tab as MHTML.
 *
 * Permissions: "pageCapture"
 */
interface PageCapture {

    // Saves the content of the tab with given id as MHTML.
    @io.shuttle.mbe.api.annotation.PromiseStyleMinVersion(116)
    abstract fun saveAsMHTML(
        details: SaveAsMHTMLDetails,
        // FIXME: js blob
        callback: Value1Function<Blob?>? = null
    ): Promise<Blob?>

    data class SaveAsMHTMLDetails(
        // The id of the tab to save as MHTML.
        var tabId: Number,
    )
}